home *** CD-ROM | disk | FTP | other *** search
/ MacWorld Secrets (4th Edition) / Mac Secrets CD 4th Ed.toast / Apple Advanced Technologies / Apple Speech Technologies 1.5 / PlainTalk Developer Info / Speech Recognition Manager SDK / SR Sample Code / IM SR Example / MyNotificationCallBack.c < prev    next >
C/C++ Source or Header  |  1996-05-02  |  1KB  |  35 lines

  1. #include <SpeechRecognition.h>
  2.  
  3. pascal void        MyNotificationCallBack (SRCallBackStruct *param);
  4.  
  5. SRRecognitionResult    gLastRecResult;
  6.  
  7. pascal void MyNotificationCallBack (SRCallBackStruct * param)
  8. {
  9.     OSErr        myErr = param->status;
  10.     
  11.     if (!myErr) {
  12.         /* Handle recognition beginning event - the user just started speaking */
  13.         /* Here we just continue speech recognition */
  14.         if ((param->what) & kSRNotifyRecognitionBeginning) {
  15.             SRRecognizer    rec = (SRRecognizer) (param->instance);
  16.             
  17.             myErr = SRContinueRecognition (rec);
  18.         }
  19.         
  20.         /* Handle recognition done event                                    */
  21.         /* Here we save the rec result in gLastRecResult.                     */
  22.         /* At idle time in our event loop, if gLastRecResult != NULL,        */
  23.         /* we call MyProcessRecognitionResult (gLastRecResult)                */
  24.         else if (param->what & kSRNotifyRecognitionDone) {
  25.             SRRecognitionResult recResult = 
  26.                                         (SRRecognitionResult) (param->message);
  27.             if (recResult)
  28.                 gLastRecResult = recResult;
  29.                 /* Note that we might get more than one result before we     */
  30.                 /* get to our idle check, so we should really be putting    */
  31.                 /* this in a queue.                                         */
  32.         }
  33.     }
  34. }
  35.